package com.andox.fn.inf.rpc.rest.protocol.registry;

import java.util.List;

import com.andox.fn.inf.rpc.rest.common.LifeCycle;
import com.andox.fn.inf.rpc.rest.config.ReferenceConfig;
import com.andox.fn.inf.rpc.rest.config.ServiceConfig;


public interface RegistryService extends LifeCycle{
	
	/**
	 * 消费者订阅
	 * @param referenceConfig
	 * @param rn
	 * @return
	 */
	List<ReferenceConfig> subscribe(ReferenceConfig referenceConfig, RegistryNotify rn);
	void unsubscribe(ReferenceConfig referenceConfig);
	
	/**
	 * 提供者注册
	 * @param serviceConfig
	 */
	void register(ServiceConfig serviceConfig);
	void unregister(ServiceConfig serviceConfig);
	
	/**
	 * 消费者主动查询提供者
	 * @param referenceConfig
	 * @return
	 */
	List<ServiceConfig> lookup(ReferenceConfig referenceConfig);
	
	public static interface RegistryNotify{
		void notify(List<ReferenceConfig> currentList);
	}
}
